-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[lldb][lldb-dap] explicitly set the expr as an alias for expression. #134562
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
dap console does not recognise `expr` as a command because it is not explicitly set. It works fine in normal lldb because it is gotten from approximate match which is not available in the SBAPI
|
@llvm/pr-subscribers-lldb Author: Ebuka Ezike (da-viper) Changesdap console does not recognise It works fine in normal lldb because it is gotten from approximate match which is not available in the SBAPI Full diff: https://github.com/llvm/llvm-project/pull/134562.diff 1 Files Affected:
diff --git a/lldb/source/Interpreter/CommandInterpreter.cpp b/lldb/source/Interpreter/CommandInterpreter.cpp
index 112d2f20fda41..a4071f5f0a602 100644
--- a/lldb/source/Interpreter/CommandInterpreter.cpp
+++ b/lldb/source/Interpreter/CommandInterpreter.cpp
@@ -444,6 +444,7 @@ void CommandInterpreter::Initialize() {
if (cmd_obj_sp) {
// Ensure `e` runs `expression`.
AddAlias("e", cmd_obj_sp);
+ AddAlias("expr", cmd_obj_sp);
AddAlias("call", cmd_obj_sp, "--")->SetHelpLong("");
CommandAlias *parray_alias =
AddAlias("parray", cmd_obj_sp, "--element-count %1 --");
@@ -1376,7 +1377,9 @@ bool CommandInterpreter::GetAliasFullName(llvm::StringRef cmd,
}
bool CommandInterpreter::AliasExists(llvm::StringRef cmd) const {
- return m_alias_dict.find(cmd) != m_alias_dict.end();
+ std::string alias_name;
+ return GetAliasFullName(cmd, alias_name);
+ // return m_alias_dict.find(cmd) != m_alias_dict.end();
}
bool CommandInterpreter::UserCommandExists(llvm::StringRef cmd) const {
|
dap console does not recognise `expr` as a command because it is not explicitly set. It works fine in normal lldb because it is gotten from approximate match which is not available in the SBAPI
|
The lldb command line was designed so that it always does shortest complete match, and there are a lot of common commands that people only type partially. Adding one more expr alias isn't such a big deal, but adding special purpose aliases for all the shortenings people want to use is not supportable (and might collide with other aliases users have set). |
|
Another solution I could think of is prioritising, the repl command type instead of the repl variable type. llvm-project/lldb/tools/lldb-dap/DAP.cpp Lines 553 to 558 in 4607d39
or add the previously defined aliases in docs explicitly as aliases. |
|
|
We may use the word So it doesn't seem wise for DAP to depend on the fixed meaning of aliases. |
|
@da-viper , I'm a bit surprised by this. Which mode are you using for the debug console? Is your problem occurring in the Auto mode? I think that in this case, using a prefix like Adding aliases is error prone because there may be people who use |
|
Probably the default is Auto. I guess we should add an option in the typescript code for selecting the mode. And about In this mode, I think it would be great to determine via a quick parsing if the input string is an actual expression or not. What would be nice would be do this:
what do you think? |

dap console does not recognise
expras a command because it is not explicitly set.It works fine in normal lldb because it is gotten from approximate match which is not available in the SBAPI